import * as echarts from 'echarts'

export const leftUpData = () => {
  return {
    backgroundColor: 'transparent',
    tooltip: {
      trigger: 'axis',
      //   axisPointer: {
      //     type: 'shadow'
      //   }
    },
    legend: {
      top: '2%',
      right: '8%',
      itemWidth: 8,
      itemHeight: 8,
    },
    grid: {
      top: '20%',
      left: '3%',
      right: '3%',
      bottom: '0%',
      containLabel: true
    },
    yAxis: {
      name: '万人',
      type: 'value',
      minInterval: 1,
      axisLine: {
        show: false,
        lineStyle: {
          color: "#6C8097",
        },
      },
      splitLine: {
        show: true
      }
    },
    xAxis: {
      type: 'category',
      axisTick: {
        show: false
      },
      axisLine: {
        lineStyle: {
          color: "#6C8097",
        },
      },
      axisLabel: { interval: 0, rotate: 45 },
      // axisLabel: {
      //   show: true,
      //   fontSize: 12,
      //   interval: 0,
      //   color: "#D0DEEE",
      //   formatter: function (params) {
      //     let newParamsName = "";
      //     let paramsNameNumber = params.length;
      //     let provideNumber = 4; //一行显示多少个文字
      //     let rowNumber = Math.ceil(paramsNameNumber / provideNumber);
      //     if (paramsNameNumber > provideNumber) {
      //       for (let p = 0; p < rowNumber; p++) {
      //         let tempStr = "";
      //         let start = p * provideNumber;
      //         let end = start + provideNumber;
      //         if (p === rowNumber - 1) {
      //           tempStr = params.substring(start, paramsNameNumber);
      //         } else {
      //           tempStr = params.substring(start, end) + "\n";
      //         }
      //         newParamsName += tempStr;
      //       }
      //     } else {
      //       newParamsName = params;
      //     }
      //     return newParamsName;
      //   }
      // },
      // data: ['a', 'b', 'c', 'd', 'e', 'f', 'g']
      data: []
    },
    series: [
      {
        name: '男',
        type: 'bar',
        barWidth: '20%',
        color: '#2176f5',
        data: [
          // 10, 20, 30, 40, 50, 60, 70
        ],
        // label: {
        //   show: true
        // },
        itemStyle: {
          // borderRadius: 10,
          color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
            {offset: 0, color: '#00595400'},
            {offset: 1, color: '#66E1DF'}
          ])
        },
      },
      {
        name: '女',
        type: 'bar',
        barWidth: '20%',
        color: '#EF5827',
        data: [
          // 70, 60, 50, 40, 30, 20, 10
        ],
        itemStyle: {
          color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
            {offset: 0, color: '#D0DEEE00'},
            {offset: 1, color: '#D0DEEEFF'}
          ])
        },
      }
    ]
  }
}

export const leftCenterData = () => {
  return {
    backgroundColor: 'transparent',
    tooltip: {},
    grid: {
      top: '20%',
      left: '3%',
      right: '5%',
      bottom: '6%',
      containLabel: true
    },
    xAxis: {
      type: "category",
      boundaryGap: false,
      axisLine: {
        //坐标轴轴线相关设置。数学上的x轴
        show: true,
        lineStyle: {
          color: "#6a6c81",
        },
      },
      splitLine: {
        show: true,
        lineStyle: {
          color: "#6a6c81",
          type: 'dashed'
        },
      },
      // axisLabel: {
      //   //坐标轴刻度标签的相关设置
      //   textStyle: {
      //     color: "#6a9cd5",
      //     margin: 15,
      //   },
      // },
      axisTick: {show: false},
      // data: [1, 2, 3, 4, 5, 6, 7, 8],
      data: [],
    },
    yAxis: {
      name: '单位',
      type: "value",
      splitNumber: 5,
      splitLine: {
        show: true,
        lineStyle: {
          color: "#6a6c81",
          type: 'dashed'
        },
      },
      axisLine: {show: true},
      // axisLabel: {
      //   margin: 20,
      //   textStyle: {
      //     color: "#6a9cd5",
      //   },
      // },
      axisTick: {show: true},
    },
    series: [
      {
        type: "line",
        smooth: true, //是否平滑曲线显示
        // symbol:'circle',  // 默认是空心圆（中间是白色的），改成实心圆
        symbolSize: 0,
        // label: {
        //   normal: {
        //     show: true
        //   },
        // },
        lineStyle: {
          normal: {
            color: "#D0DEEE",
            width: 1
          },
        },
        areaStyle: {
          //区域填充样式
          normal: {
            //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
            color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                {offset: 0, color: "#D0DEEE00"},
                {offset: 1, color: "#D0DEEEFF"},
              ], false
            ),
          },
        },
        // data: [10, 20, 30, 40, 30, 20, 10, 44],
        data: [],
      }, {
        type: "line",
        smooth: true, //是否平滑曲线显示
        // symbol:'circle',  // 默认是空心圆（中间是白色的），改成实心圆
        symbolSize: 0,
        // label: {
        //   normal: {
        //     show: true
        //   },
        // },
        lineStyle: {
          normal: {
            color: '#66E1DF',
            width: 1
          },
        },
        areaStyle: {
          //区域填充样式
          normal: {
            //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
            color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                {offset: 0, color: "#00595400"},
                {offset: 1, color: "#66E1DFFF"},
              ], false
            ),
          },
        },
        // data: [40, 10, 55, 30, 60, 10, 90, 22],
        data: [],
      }
    ]
  }
}

export const leftDownData = () => {
  return {
    backgroundColor: 'transparent',
    color: ['#159AFF', '#66E1DF', '#D0DEEE', '#1563FF', '#34FFBF', '#159AFF'],
    series: [
      {
        radius: ['64%', '80%'],
        center: ['50%', '50%'],
        type: 'pie',
        // silent: true,//图形是否不响应和触发鼠标事件，默认为 false，即响应和触发鼠标事件。
        label: {
          fontSize: 16,
          show: false,
          formatter: "{c}例",
          color: "#fff",
          position: 'outside',
        },
        emphasis: {
          disabled: true
        },
        labelLine: {
          show: true,
          length: 20,
          length2: 25
        },
        name: "",
        data: [
          // {"name": "nameA", "value": 650},
          // {"name": "nameB", "value": 750},
          // {"name": "nameC", "value": 980},
          // {"name": "nameD", "value": 530},
          // {"name": "nameE", "value": 450}
        ],
      },
      {
        radius: ['59%', '60%'],
        center: ['50%', '50%'],
        silent: true,
        type: 'pie',
        label: {show: false},
        labelLine: {show: false},
        animation: false,
        tooltip: {
          show: false
        },
        data: [{
          value: 1,
          itemStyle: {
            color: "#6C8097FF",
          },
        }],
      },
      {
        name: '外边框',
        type: 'pie',
        clockwise: false, //顺时加载
        // silent: true,
        center: ['50%', '50%'],
        radius: ['86%', '86%'],
        label: {show: false},
        data: [{
          value: 9,
          name: '',
          itemStyle: {
            borderWidth: 4,
            borderColor: '#6C809733'
          }
        }]
      }
    ]
  }
}

export const result = () => ({
  "result": "true",
  "data": {
    "mainData": {
      "total": 31099,
      "onCampus": 8180,
      "peer": 597,
      "afterSchool": 22919,
      "floor1": "行政综合楼",
      "floor2": "行政综合楼",
      "floor3": "行政综合楼",
      "floor4": "行政综合楼"
    },
    "passRecords": [
      {
        "status": "进校",
        "name": "刘*",
        "time": "2024-01-29 15:22:07",
        "deptName": "智能制造与汽车学院"
      },
      {
        "status": "出校",
        "name": "易**",
        "time": "2024-01-29 15:20:35",
        "deptName": "后勤保障处"
      },
      {
        "status": "进校",
        "name": "卢*",
        "time": "2024-01-29 15:20:28",
        "deptName": "智能制造与汽车学院"
      },
      {
        "status": "出校",
        "name": "谢**",
        "time": "2024-01-29 15:19:39",
        "deptName": "工会"
      },
      {
        "status": "出校",
        "name": "孙**",
        "time": "2024-01-29 15:19:37",
        "deptName": "工会"
      },
      {
        "status": "进校",
        "name": "易**",
        "time": "2024-01-29 15:16:47",
        "deptName": "后勤保障处"
      },
      {
        "status": "出校",
        "name": "易**",
        "time": "2024-01-29 15:16:35",
        "deptName": "后勤保障处"
      },
      {
        "status": "进校",
        "name": "熊*",
        "time": "2024-01-29 15:15:43",
        "deptName": "后勤保障处"
      },
      {
        "status": "出校",
        "name": "秦**",
        "time": "2024-01-29 15:15:08",
        "deptName": "建筑与材料学院"
      }
    ],
    "userTypePassCounts": [
      {
        "name": "教职工",
        "value": 158,
        "percent": "26.47%"
      },
      {
        "name": "学生",
        "value": 141,
        "percent": "23.62%"
      },
      {
        "name": "其他",
        "value": 298,
        "percent": "49.92%"
      }
    ],
    "userTypeDistributions": [
      {
        "name": "校外协作人员",
        "value": 2018,
        "percent": "6.49%"
      },
      {
        "name": "学生",
        "value": 25316,
        "percent": "81.40%"
      },
      {
        "name": "教师",
        "value": 1456,
        "percent": "4.68%"
      },
      {
        "name": "外聘教师",
        "value": 2307,
        "percent": "7.42%"
      },
      {
        "name": "临时人员",
        "value": 2,
        "percent": "0.01%"
      }
    ],
    "periodPassCounts": [
      {
        "time": "01:00",
        "today": 5,
        "yesterday": 10,
        "week": 5,
        "month": 4748
      },
      {
        "time": "04:00",
        "today": 8,
        "yesterday": 5,
        "week": 8,
        "month": 911
      },
      {
        "time": "07:00",
        "today": 141,
        "yesterday": 108,
        "week": 141,
        "month": 24790
      },
      {
        "time": "10:00",
        "today": 199,
        "yesterday": 154,
        "week": 199,
        "month": 31913
      },
      {
        "time": "12:00",
        "today": 151,
        "yesterday": 110,
        "week": 151,
        "month": 43330
      },
      {
        "time": "14:00",
        "today": 93,
        "yesterday": 130,
        "week": 93,
        "month": 39422
      },
      {
        "time": "16:00",
        "today": 0,
        "yesterday": 165,
        "week": 0,
        "month": 54105
      },
      {
        "time": "19:00",
        "today": 0,
        "yesterday": 262,
        "week": 0,
        "month": 92634
      },
      {
        "time": "22:00",
        "today": 0,
        "yesterday": 53,
        "week": 0,
        "month": 31133
      }
    ],
    "deptCount": {
      "page": 1,
      "pageSize": 10,
      "total": 27,
      "list": [
        {
          "name": "图文信息中心",
          "man": 0,
          "woman": 4
        },
        {
          "name": "体育与国防教学部",
          "man": 1,
          "woman": 2
        },
        {
          "name": "安全管理处",
          "man": 2,
          "woman": 0
        },
        {
          "name": "重庆电子工程职业学院",
          "man": 0,
          "woman": 1
        },
        {
          "name": "后勤保障处",
          "man": 107,
          "woman": 87
        }, {
          "name": "电子与物联网学院",
          "man": 27,
          "woman": 1
        },
        {
          "name": "人工智能与大数据学院",
          "man": 38,
          "woman": 32
        },
        {
          "name": "建筑与材料学院",
          "man": 11,
          "woman": 7
        },
        {
          "name": "国际交流与合作发展处",
          "man": 4,
          "woman": 0
        },
        {
          "name": "财经管理学院",
          "man": 20,
          "woman": 18
        }
      ]
    }
  },
  "message": "请求成功"
})